/* eslint-disable no-unreachable */
<template>
    <div class="mainDiv">
        <router-link to="/from" style="float:right"><i class="el-icon-circle-plus-outline"></i></router-link>
        <div style="margin:auto">
            <img src="@/assets/img.png">
        </div>
        <div class="quo">{{quotations}}</div>
        <div class="fr">-- {{from}}</div>
    </div>
</template>

<script>
import datas from "@/assets/data"
export default {
    name:"Quotations",
    data(){
        return {
            quotations:"",
            from:""
        }
    },
    created(){
        let dataArr = datas.datas;
        let random = this.randomNum(0,dataArr.length-1);
        let data = dataArr[random].split("|");
        this.quotations = data[0];
        this.from = data[1];
    },
    methods: {
        randomNum(minNum,maxNum){ 
            switch(arguments.length){ 
                case 1: 
                    return parseInt(Math.random()*minNum+1,10); 
                // eslint-disable-next-line no-unreachable
                break; 
                case 2: 
                    return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10); 
                // eslint-disable-next-line no-unreachable
                break; 
                default: 
                    return 0; 
                // eslint-disable-next-line no-unreachable
                break; 
            } 
        }
    }
}

</script>

<style scoped>
    .mainDiv {
        font-size:22px;
        line-height: 66px;
        height:90vh;
    }
</style>